package com.beerandjesus.sportofkings.handicapper.strategy.brisnet.singlefile;

import com.beerandjesus.sportofkings.handicapper.model.MaidenHorseAnalysisResultImpl;
import com.beerandjesus.sportofkings.handicapper.model.NonMaidenHorseAnalysisResultImpl;
import com.beerandjesus.sportofkings.handicapper.model.ResultType;
import com.beerandjesus.sportofkings.handicapper.model.brisnet.singlefile.Horse;

public class ResultTypeResolver extends AbstractResolver {
    public ResultTypeResolver() {
    }

    void resolveTypeForMaidens(MaidenHorseAnalysisResultImpl result, Horse horse) {
        ResultType resultType;
        int numStarts = horse.getPastPerformances().size();
        if (numStarts == 0) {
            resultType = ResultType.FIRST_TIME_STARTER;
        } else if (numStarts == 1) {
            resultType = ResultType.SECOND_TIME_STARTER;
        } else {
            resultType = ResultType.OLDER_MAIDEN;
        }
        result.setResultType(resultType);
    }


    void resolveTypeForNonMaidens(NonMaidenHorseAnalysisResultImpl result, Horse horse) {
        // Quirin style speed points
        Integer qPts = getInteger(horse.getQuirinSpeedPoints(), -1);
        result.setQuirinSpeedPoints(qPts.toString());
        ResultType type;
        if (qPts < 0) {
            type = ResultType.UNKNOWN;
        } else if (qPts < 4) {
            type = ResultType.SLOW_EARLY_SPEED;
        } else {
            type = ResultType.FAST_EARLY_SPEED;
        }
        result.setResultType(type);
    }

}